part of 'widget.dart';

// ignore: camel_case_types
class _AppFooterView_1200_infinity extends StatelessWidget {
  const _AppFooterView_1200_infinity({
    required _AppFooterWloc wloc,
  }) : _wloc = wloc;

  final _AppFooterWloc _wloc;

  Widget _buildContent({
    required BuildContext context,
  }) {
    return Center(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          const SizedBox(
            height: 40,
          ),
          Row(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const SizedBox(
                width: 32,
              ),
              Flexible(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    _buildLegalInformationBlockTitle(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildTermsOfUseLabel(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildPrivacyPolicyLabel(
                      context: context,
                    ),
                  ],
                ),
              ),
              const SizedBox(
                width: 84,
              ),
              Flexible(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    _buildAboutAppBlockTitle(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildDocumentationLabel(
                      context: context,
                    ),
                  ],
                ),
              ),
              const SizedBox(
                width: 84,
              ),
              Flexible(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    _buildAboutCompanyBlockTitle(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildCompanyNameLabel(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildCompanyInnLabel(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildCompanyOgrnLabel(
                      context: context,
                    ),
                  ],
                ),
              ),
              const SizedBox(
                width: 84,
              ),
              Flexible(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    _buildSupportBlockTitle(
                      context: context,
                    ),
                    const SizedBox(
                      height: 6,
                    ),
                    _buildFaqLabel(
                      context: context,
                    ),
                    _buildContactLabel(
                      context: context,
                    ),
                  ],
                ),
              ),
              const SizedBox(
                width: 32,
              ),
            ],
          ),
          const SizedBox(
            height: 40,
          ),
          _buildCopyrightLabel(
            context: context,
          ),
          const SizedBox(
            height: 40,
          ),
        ],
      ),
    );
  }

  Widget _buildLegalInformationBlockTitle({
    required BuildContext context,
  }) {
    return Text(
      AppFooterTranslation.of(context).legalInformationBlockTitle,
      style: AppFooterTheme.of(context).textTheme.blockTitle,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildTermsOfUseLabel({
    required BuildContext context,
  }) {
    final markdown = AppFooterTranslation.of(context).buildTermsOfUseLabelMarkdown(
      termsOfUseHref: _Hrefs.termsOfUse,
    );

    return buildMarkdown(
      markdown: markdown,
      textStyle: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
      context: context,
      onLinkPressed: _wloc.onLinkPressed,
    );
  }

  Widget _buildPrivacyPolicyLabel({
    required BuildContext context,
  }) {
    final markdown = AppFooterTranslation.of(context).buildPrivacyPolicyLabelMarkdown(
      privacyPolicyHref: _Hrefs.privacyPolicy,
    );

    return buildMarkdown(
      markdown: markdown,
      textStyle: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
      context: context,
      onLinkPressed: _wloc.onLinkPressed,
    );
  }

  Widget _buildAboutAppBlockTitle({
    required BuildContext context,
  }) {
    return Text(
      AppFooterTranslation.of(context).aboutAppBlockTitle,
      style: AppFooterTheme.of(context).textTheme.blockTitle,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildDocumentationLabel({
    required BuildContext context,
  }) {
    final markdown = AppFooterTranslation.of(context).buildDocumentationLabelMarkdown(
      documentationPageHref: _Hrefs.documentationPage,
    );

    return buildMarkdown(
      markdown: markdown,
      textStyle: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
      context: context,
      onLinkPressed: _wloc.onLinkPressed,
    );
  }

  Widget _buildAboutCompanyBlockTitle({
    required BuildContext context,
  }) {
    return Text(
      AppFooterTranslation.of(context).aboutCompanyBlockTitle,
      style: AppFooterTheme.of(context).textTheme.blockTitle,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildCompanyNameLabel({
    required BuildContext context,
  }) {
    return Text(
      AppFooterTranslation.of(context).companyNameLabel,
      style: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildCompanyInnLabel({
    required BuildContext context,
  }) {
    final label = AppFooterTranslation.of(context).buildCompanyInnLabel(
      inn: Config().companyInn,
    );

    return Text(
      label,
      style: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildCompanyOgrnLabel({
    required BuildContext context,
  }) {
    final label = AppFooterTranslation.of(context).buildCompanyOgrnLabel(
      ogrn: Config().companyOgrn,
    );

    return Text(
      label,
      style: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildSupportBlockTitle({
    required BuildContext context,
  }) {
    return Text(
      AppFooterTranslation.of(context).supportBlockTitle,
      style: AppFooterTheme.of(context).textTheme.blockTitle,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  Widget _buildFaqLabel({
    required BuildContext context,
  }) {
    final markdown = AppFooterTranslation.of(context).buildFaqLabelMarkdown(
      faqPageHref: _Hrefs.faqPage,
    );

    return buildMarkdown(
      markdown: markdown,
      textStyle: AppFooterTheme.of(context).textTheme.blockLabel,
      textAlign: TextAlign.start,
      textWidthBasis: TextWidthBasis.longestLine,
      context: context,
      onLinkPressed: _wloc.onLinkPressed,
    );
  }

  Widget _buildContactLabel({
    required BuildContext context,
  }) {
    final markdown = AppFooterTranslation.of(context).buildSupportEmailLabelMarkdown(
      supportEmail: Config().supportEmail,
      supportEmailHref: _Hrefs.supportEmail,
    );

    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        AppButton(
          onPressed: _wloc.onTelegramButtonPressed,
          padding: const EdgeInsets.all(3),
          child: SvgPicture.asset(
            _wloc.telegramIconAssetPath,
            height: 24,
            width: 24,
          ),
        ),
        const SizedBox(
          width: 4,
        ),
        Flexible(
          child: Padding(
            padding: const EdgeInsets.symmetric(
              vertical: 6,
            ),
            child: buildMarkdown(
              markdown: markdown,
              textStyle: AppFooterTheme.of(context).textTheme.blockLabel,
              textAlign: TextAlign.start,
              textWidthBasis: TextWidthBasis.longestLine,
              context: context,
              onLinkPressed: _wloc.onLinkPressed,
            ),
          ),
        ),
      ],
    );
  }

  Widget _buildCopyrightLabel({
    required BuildContext context,
  }) {
    final label = AppFooterTranslation.of(context).buildCopyrightLabel(
      currentTime: DateTime.now(),
    );

    return Text(
      label,
      style: AppFooterTheme.of(context).textTheme.copyright,
      textAlign: TextAlign.center,
      textWidthBasis: TextWidthBasis.longestLine,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      color: AppFooterTheme.of(context).backgroundColor,
      child: _buildContent(
        context: context,
      ),
    );
  }
}
